{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Set-up procedure"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Update notebooks with your project, bucket, and region"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 0\n",
    "[Create a bucket](http://console.cloud.google.com/storage) if you haven't already."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Fill in with your GCP project, bucket, and desired region.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "env: PROJECT=crawles-sandbox\n",
      "env: BUCKET=crawles-sandbox\n",
      "env: REGION=us-central1\n"
     ]
    }
   ],
   "source": [
    "# e.g., %env PROJECT=qwiklabs-...\n",
    "%env PROJECT=\n",
    "%env BUCKET=\n",
    "%env REGION=us-central1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 3\n",
    "Run script to update all notebooks"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "%%bash\n",
    "# Updates project.\n",
    "string2replace=\"PROJECT = 'cloud-training-demos'\"\n",
    "grep -rl \"$string2replace\" ./ | xargs sed -i \"s/$string2replace/PROJECT = '$PROJECT'/g\"\n",
    "# Updates bucket.\n",
    "string2replace=\"BUCKET = 'cloud-training-bucket'\"\n",
    "grep -rl \"$string2replace\" ./ | xargs sed -i \"s/$string2replace/BUCKET = '$BUCKET'/g\"\n",
    "# Updates region.\n",
    "string2replace=\"REGION = 'us-central1'\"\n",
    "grep -rl \"$string2replace\" ./ | xargs sed -i \"s/$string2replace/REGION = '$REGION'/g\""
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
